var a;
console.log(a);
a = 10;

let str = 'Hello';
console.log(str, 'before');
str = 1;
console.log(str, 'after');

// const HelloWorld = 'Hello World' + str + 'xxxxx' + a + 'xxxxx';
// console.log(HelloWorld);
const HelloWorld = `Hello World${str}`
console.log(HelloWorld);

var b;
if (b) {
    console.log(b, 'before');
}

b = 6;

if (b) {
    console.log(b, 'after');
}

let str1 = '0';
let str2 = 0;
console.log(!str1, 'str-----');
console.log(!str2, 'str2-----');

// const pElement = document.getElementById('p-test');
// pElement.innerHTML = '<script>console.log("这是一个脚本")</script>';

// console.log(document.querySelector('#p-test'), '这是P标签');

// console.log(document.querySelectorAll('p'), '这是P标签');

const pElement = document.getElementById('p-test');

pElement.addEventListener('click', function(event) {
    console.log(event, 'event');
    alert('点击了P标签');
});

function validateInput() {
    const inputElement = document.querySelector('input');
    if (!inputElement.value) {
        alert('输入框不能为空')
    }
}